1. Field of the Invention
The present invention relates to virtual machines within computer systems. More specifically, the present invention relates to a method and an apparatus for keeping track of memory usage for tasks in a shared heap without performing a full garbage-collection operation.
2. Related Art
The Java 2 Platform, Micro Edition (J2ME™), has become very popular in the wireless device space. Motorola, Nokia, NTT DoCoMo, RIM, Siemens, and many other key players in the wireless device industry have recently started shipping J2ME-enabled devices in very high volume. It has been estimated that over 200 million J2ME-enabled mobile phones were shipped in 2003 alone.
In order to effectively run applications on the new memory-constrained computing devices, a number of techniques have been developed to conserve memory. One promising technique involves providing a shared heap wherein objects from different tasks can be stored. This can greatly save memory space in comparison to the conventional technique of providing a separate heap for each thread. However, this shared heap technique complicates both garbage-collection operations and memory accounting operations.
In traditional non-memory-constrained computing systems, additional data structures, such as lookup tables, can be used to keep track of memory allocation by individual tasks. However, in memory-constrained computing devices, memory is extremely scarce. It is consequently impractical to use additional data structures to keep track of memory allocation, because the additional space used by the data structures would largely eliminate the space savings gained by using a shared heap.
Hence, what is needed is a method and an apparatus for keeping track of memory usage for tasks in a shared heap without the problems listed above.